home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / amok / 061-070 / amok65 / rvi / txt / rvi.mod < prev    next >
Text File  |  1993-11-04  |  4KB  |  98 lines

  1. (*************************************************************************
  2.  
  3. :Program.    RVI.mod
  4. :Contents.   Oberon Interface for the REXX Variables Interface
  5. :Support.    RVI (rexxvars.o) (C) by William S. Hawes
  6. :Author.     Martin Horneffer
  7. :Copyright.  Freely Distributable
  8. :Language.   Oberon
  9. :Translator. Amiga Oberon Compiler V2.25d
  10. :History.    V1.0 10 Feb 1992, Martin Horneffer
  11. :Address.    Warmweiherstraße 18, W-5100 Aachen
  12. :Phone.      0(049)241-535233
  13. :Remark.     names of ARexx variable MUST be uppercase!
  14. :Remark.     STEMs are nothing but variables with names that
  15. :Remark.     contain a dot (".").
  16. :Remark.     When recompiling this module, please remember
  17. :Remark.     to c:join rvi/rexxvars.o to RVI.obj (or RVI.objs)
  18.  
  19. *************************************************************************)
  20.  
  21. MODULE RVI;
  22.  
  23. (* REXX Variables Interface *)
  24.  
  25. IMPORT Rexx, Exec, SYSTEM;
  26.  
  27. (*
  28.  * CheckRexxMsg()
  29.  * Usage: boolean = CheckRexxMsg(message);
  30.  *
  31.  * This function verifies that the message pointer is a valid RexxMsg and
  32.  * that it came from an ARexx macro program.  The validation test is more
  33.  * stringent  than that performed by the ARexx library function IsRexx().
  34.  * The latter verifies that the message is tagged as a RexxMsg structure,
  35.  * but  not  that  it necessarily came from an ARexx macro program.  Each
  36.  * macro  program  installs a pointer to its global data structure in the
  37.  * command  message,  and this pointer is necessary to gain access to the
  38.  * symbol table.
  39.  *
  40.  * The return from the function will be non-zero (TRUE) if the message is
  41.  * valid, and 0 (FALSE) otherwise.
  42.  *)
  43. PROCEDURE CheckRexxMsg*{"CheckRexxMsg"}( message{8}: Rexx.RexxMsgPtr): BOOLEAN;
  44.  
  45. (*
  46.  * GetRexxVar()
  47.  * Usage: error = GetRexxVar(message,variable,&value);
  48.  *
  49.  * This function retrieves the current value for the specified variable name.
  50.  * It first validates the message using CheckRexxMsg() and then, if the
  51.  * message pointer is valid, retrieves the value string and passes it in the
  52.  * supplied return pointer.  The return pointer is actually an argstring (an
  53.  * offset pointer to a RexxArg structure), but can be treated as a pointer
  54.  * to a null-terminated string.  The value must not be disturbed by the host.
  55.  *
  56.  * The function return will be zero if the value was successfully retrieved
  57.  * and non-zero otherwise.  An error code of 10 indicates an invalid message.
  58.  *)
  59. PROCEDURE GetRexxVarA1*{"GetRexxVar"}( message{8}    : Rexx.RexxMsgPtr;
  60.                                        variable{9}    : ARRAY OF CHAR): LONGINT;
  61. (* value returned in A1 *)
  62.  
  63. PROCEDURE GetRexxVar*( message    : Rexx.RexxMsgPtr;
  64.                        variable    : ARRAY OF CHAR;
  65.                        VAR value: Exec.STRPTR): LONGINT;
  66.   (* $CopyArrays- *)
  67.   VAR error: LONGINT;
  68.   BEGIN
  69.     error := GetRexxVarA1(message,variable);
  70.     value := SYSTEM.REG(9);
  71.     RETURN error;
  72.   END GetRexxVar;
  73.  
  74. (*
  75.  * SetRexxVar()
  76.  * Usage: error = SetRexxVar(message,variable,value,length);
  77.  *
  78.  * This  function  installs  a  value  in  the  specified  variable.   It
  79.  * validates  the  message pointer using CheckRexxMsg() and then installs
  80.  * the  value,  creating  a symbol table entry if required.  The value is
  81.  * supplied  as a pointer to a data area along with the total length; the
  82.  * data may contain arbitrary values and need not be null-terminated.
  83.  *
  84.  * The  function  return  will  be  zero  if  the call was successful and
  85.  * non-zero  otherwise.   The possible error codes are given in the table
  86.  * below.
  87.  *
  88.  *    Error Code  Reason for Failure
  89.  *        3       Insufficient storage
  90.  *        9       String too long
  91.  *       10       Invalid message
  92.  *)
  93. PROCEDURE SetRexxVar*{"SetRexxVar"}( message{8}    : Rexx.RexxMsgPtr;
  94.                                      variable{9}: ARRAY OF CHAR;
  95.                                      value{0}    : ARRAY OF CHAR;
  96.                                      length{1}    : LONGINT): LONGINT;
  97. END RVI.
  98.